<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <link rel="stylesheet" title="Default" href="http://acm.math.spbu.ru/~sk1/colorer/my.css">

  <script src="http://acm.math.spbu.ru/~sk1/colorer/highlight.js"></script>
  <script src="http://acm.math.spbu.ru/~sk1/colorer/cpp.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
</head>

<body>

<pre><code>
#include &lt;algorithm&gt;

using namespace std;

struct Tree
{
  int *t, n;

  Tree( int _n, int *a ) : n(_n)
  {
    t = new int[2 * n];
    for (int i = 0; i &lt; n; i++)
      t[n + i] = a[i];
    for (int i = n - 1; i &gt; 0; i--)
      t[i] = min(t[2 * i], t[2 * i + 1]);
  }

  void change( int i, int x )
  {
    t[n + i] = x;
    for (i = (n + i) / 2; i &gt; 0; i /= 2)
      t[i] = min(t[2 * i], t[2 * i + 1]);
  }

  int get( int l, int r )
  {
    int res = 1 &lt;&lt; 30;
    for (l += n, r += n; l &lt;= r; l &gt;&gt;= 1, r &gt;&gt;= 1)
    {
      if ((l & 1) == 1) res = min(res, t[l++]);
      if ((r & 1) == 0) res = min(res, t[r--]);
    }
    return res;
  }
};

</code></pre>

</body>
</html>

<font style="visibility:hidden">
